package cn.xabad.server.thea.jpa

import cn.xabad.server.thea.bean.TheaConfig
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Modifying
import org.springframework.data.jpa.repository.Query
import org.springframework.data.repository.query.Param
import javax.transaction.Transactional

interface TheaConfigRepo : JpaRepository<TheaConfig, Int> {
    fun findByK(k:String):List<TheaConfig>
    fun findByV(v:String):List<TheaConfig>

    @Modifying
    @Transactional
    @Query(value = "UPDATE TheaConfig c set c.k = :k where c.v = :v")
    fun updateByV(@Param("k") k:String,@Param("v") v:String)
}